﻿namespace Wigy.TimeInsight
{
    internal partial class MainWindow
    {
        private readonly ComputerBasedTrainingHook _hook = new ComputerBasedTrainingHook();

        public MainWindow()
        {
            InitializeComponent();
        }

        public string Log
        {
            get { return _log.Text; }
            set { _log.Text = value; }
        }

        private void HandleClosed(object sender, System.EventArgs e)
        {
            _hook.Dispose();
        }

        private void HandleInitialized(object sender, System.EventArgs e)
        {
            _hook.WindowAction += HookWindowEvent;
            _hook.Install();
        }

        private void HookWindowEvent(object sender, WindowActionEventArgs e)
        {
            Log = string.Format("{0}\r\n'{1}'({2})", Log, e.Title, e.ClassName);
        }
    }
}
